<template>
  <div class="pay-success">
    <h3 class="title">
      <icon type="success"></icon>
      <span>支付成功</span>
    </h3>
    <div class="preview">
      <div class="item">
        <label>订单金额</label>
        <p>{{orderData.realMoney}}</p>
      </div>
      <div class="item">
        <label>购买服务</label>
        <p>{{orderData.question}}</p>
      </div>
      <div class="item">
        <label>服务大师</label>
        <p>{{orderData.masterName}}</p>
      </div>
      <div class="item">
        <label>订单编号</label>
        <p>{{orderData.orderNo}}</p>
      </div>
      <div class="item">
        <label>订单时间</label>
        <p>{{orderData.createtime}}</p>
      </div>
    </div>
		<group gutter="0" class="go-chat">
			<x-button type="primary" @click.native="goChat">提交咨询</x-button>
		</group>
  </div>
</template>

<script>
export default {
  data() {
    return {
      orderData: {},
    }
  },
  computed: {
    uid() {
			return this.$store.state.userId;
		},
		ono() {
			return this.$route.query.id;
    },
  },
  methods: {
		getOrder() {
			this.$http.fetchGet('payreturn', {
				userId: this.uid,
        orderNo: this.ono,
        // payMethod: 'wxpay',
			}).then(({data = {}}) => {
				console.log('确认订单', data);
				this.orderData = data;
			})
    },
		goChat() {
      let path = this.orderData.questionType
      if(path == 1 || path == 2) {
        path = "/orderform?type=1,2&key=0"
      } else if(path == 3) {
        path = `/userAdvisory?ding=${this.orderData.consultanceid}&status=进行中`
      }
      this.$router.push({
        path: path
      })
    }
  },
  created () {
    this.getOrder();
  }
};
</script>

<style scoped lang="less">
.pay-success {
  .title{
    .mt(20);
    .h(100);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    .weui-icon-success{
      .px2rem(font-size, 42);
    }
    span{
      .f30;
      .ml(20);
    }
  }
  .preview{
    .p(20);
    background-color: #ffffff;
    .item{
      display: flex;
      line-height: 2;
      .f26;
      color: #666;
      label{
        width: 5em;
      }
      p{
        flex: 1;
        text-align: right;
      }
    }
  }
	.go-chat{
		.p(20);
    .mt(20);
		background-color: #ffffff;
	}
}
</style>